<?php
class Netflix_Rating {
	
	/**
	 * User Rating.
	 *
	 * @var unknown_type
	 */
	public $userRating;
	
	/**
	 * Predicted Rating.
	 *
	 * @var unknown_type
	 */
	public $predictedRating;
	
	/**
	 * Last Updated.
	 *
	 * @var unknown_type
	 */
	public $updated;
	
	/**
	 * User Id.
	 *
	 * @var unknown_type
	 */
	public $userId;
	
	/**
	 * Title the rating belongs to.
	 *
	 * @var unknown_type
	 */
	public $title;
	
	/**
	 * Title API URL Ref.
	 *
	 */
	public $titleURL;
	
	public function __construct(){}
	
	public function loadXML($ratingXML){
		
		//Intialize and Set all variables
		$this->userRating      = (string)$ratingXML->user_rating;
		$this->predictedRating = (string)$ratingXML->predicted_rating;
		$this->updated         = (string)$ratingXML->updated;
		$this->title           = (string)$ratingXML->title;
		
		foreach($ratingXML->link as $link){
			
			$title = (string)$link['title'];
			$href  = (string)$link['href'];
			
			if($title == "title"){
				$this->titleURL        = $href;
			}
		}
	}
	
}
?>